home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000033_icon-group-sender_Wed Mar 12 12:35:15 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2CJX6c03437
  4.     for icon-group-addresses; Wed, 12 Mar 2003 12:33:06 -0700 (MST)
  5. Message-Id: <200303121933.h2CJX6c03437@baskerville.CS.Arizona.EDU>
  6. X-Authentication-Warning: weaver.tuc.noao.edu: swampler set sender to swampler@noao.edu using -f
  7. Subject: Re: Sorting lists
  8. From: Steve Wampler <swampler@noao.edu>
  9. To: rjhare@ed.ac.uk
  10. Cc: icon-group@cs.arizona.edu
  11. Date: 12 Mar 2003 08:51:45 -0700
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. On Wed, 2003-03-12 at 07:21, rjhare@ed.ac.uk wrote:
  16. > I don't have the book to hand and am sitting in an Icon-free zone at
  17. > the moment. What do I get if I sort a list of lists like this:
  18. > [ [b,c], [a,d] ]
  19. > I hope I get:
  20. > [ [a,d], [b,c]]
  21. > but fear that I might get:
  22. > [ a, b, c, d]
  23. > Thanks.
  24. > Roger Hare
  25.  
  26. To make sure I understand, you have (say)
  27.  
  28.    a := [ ["b","c"], ["a","d"] ]
  29.  
  30. and want to know the result of sort(a), right?
  31.  
  32. The answer is that you won't get [ "a", "b", "c", "d" ],
  33. but you probably will not get [ ["a","d"], ["b", "c"] ], either.
  34.  
  35. When sorting a list of structures (what you have), the
  36. sorting order is by time of creation of those structures.
  37.  
  38. Icon won't look 'inside' those structures to see what they
  39. contain.  So, since ["b","c"] was created before ["a","d"]
  40. in the above example, I would expect the result of the
  41. sort to be [ ["b","c"], ["a","d"] ].
  42.  
  43. Hope that helps!
  44. -- 
  45. Steve Wampler <swampler@noao.edu>
  46. National Solar Observatory
  47.